package com.hzx.ssm.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel("响应实体类")
public class ResBean {
    @ApiModelProperty("返回状态码")
    private int code;
    @ApiModelProperty("返回的消息")
    private String message;
    @ApiModelProperty("返回的数据")
    private Object obj;

    public ResBean(int code, String message,Object obj) {
        this.code = code;
        this.message = message;
        this.obj = obj;
    }
    public ResBean(){

    }

    public static ResBean sucess(int code,String message){
        return new ResBean(code,message,null);
    }
    public static ResBean sucess(int code,String message,Object obj){
        return new ResBean(code,message,obj);
    }
    public static ResBean error(int code,String message){
        return new ResBean(401,message,null);
    }

    @Override
    public String toString() {
        return "ResBean{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", obj=" + obj +
                '}';
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getObj() {
        return obj;
    }

    public void setObj(Object obj) {
        this.obj = obj;
    }
}
